<template>
  <div class="warning-info">
    <!-- 标题 -->
    <div class="panel-header">
      <h3 class="panel-title">预警信息</h3>
      <!-- 查看更多 -->
      <div class="view-more" @click="handleViewMore">
        <span>查看更多</span>
        <img :src="viewMoreIcon" alt="查看更多">
      </div>
    </div>
    <!-- 内容 -->
    <div class="panel-content">
      <!-- 预警信息列表 -->
      <div class="warning-info-list">
        <div v-for="item in warningInfoList" :key="item.id" class="warning-info-item">
          <!-- 图片 -->
          <div class="warning-info-item-img">
            <el-image :src="item.img" fit="fill" />
          </div>
          <!-- 无人机信息 -->
          <div class="warning-info-item-uav-info">
            <div class="uav-icon">
              <img :src="uavIcon" alt="无人机">
            </div>
            <div class="uav-info">
              <div class="uav-name">{{ item.uavName }}</div>
              <div class="uav-name2">人</div>
            </div>
          </div>
          <!-- 日期 -->
          <div class="warning-info-item-date">
            <div class="item-date">
              {{ item.date }}
            </div>
            <div class="item-time">
              {{ item.time }}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
// 预警信息组件
import viewMoreIcon from '@/assets/images/view_more.png' // 查看更多icon
import uavIcon from '@/assets/images/dashboard_warning_info_UAV.png' // 无人机icon
import { ref } from 'vue'
import { ElMessage, ElImage } from 'element-plus'

const warningInfoList = ref([
  {
    id: 1,
    img: 'https://s21.ax1x.com/2025/07/12/pVlNu7D.png',
    uavName: 'Matrice 350 RTK',
    date: '2025-07-12',
    time: '10:00:00',
  },
  {
    id: 2,
    img: 'https://s21.ax1x.com/2025/07/12/pVlNQtH.png',
    uavName: 'Matrice 350 RTK',
    date: '2025-07-12',
    time: '10:00:00',
  },
])

/**
 * 查看更多
 */
const handleViewMore = () => {
  // 弹出提示框
  ElMessage.warning('暂无更多预警信息')
}
</script>

<style lang="scss" scoped>
.warning-info {
  width: 404px;
  height: 258px;
  background: url('@/assets/images/dashboard_normal_model_bg.png') no-repeat center center;
  background-size: 100% 100%;
  display: flex;
  flex-flow: column nowrap;
  justify-content: flex-start;
  align-items: flex-start;
  .panel-header {
    width: 100%;
    height: 38px;
    display: flex;
    flex-flow: row nowrap;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    box-sizing: border-box;
    
    .panel-title {
      font-size: 18px;
      font-weight: 900;
      letter-spacing: 2px;
      line-height: 18px;
      vertical-align: top;
      background: linear-gradient(180deg, rgba(238, 238, 238, 1) 0%, rgba(238, 238, 238, 1) 40%, rgba(59, 135, 202, 1) 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      filter: drop-shadow(0px 2px 3px rgba(0, 0, 0, 0.5));
      position: relative;
      bottom: -2px;
    }

    .view-more {
      display: flex;
      flex-flow: row nowrap;
      justify-content: flex-end;
      align-items: center;
      position: relative;
      bottom: -2px;
      cursor: pointer;
      span {
        font-size: 16px;
        font-weight: 500;
        letter-spacing: 0px;
        line-height: 16px;
        color: rgba(175, 215, 230, 1);
      }
      img {
        width: 16px;
        height: 16px;
        margin-left: 7px;
      }
    }
  }
  
  .panel-content {
    flex: 1;
    width: 100%;
    display: flex;
    flex-flow: row nowrap;
    justify-content: center;
    align-items: center;
    // 预警信息列表
    .warning-info-list {

      .warning-info-item {
        width: 376px;
        height: 83px;
        background: linear-gradient(90deg, rgba(5, 140, 187, 0.25) 0%, rgba(5, 173, 187, 0.07) 100%);
        display: flex;
        flex-flow: row nowrap;
        justify-content: flex-start;
        align-items: center;
        padding: 8px;
        box-sizing: border-box;
        & + .warning-info-item {
          margin-top: 8px;
        }
        // 图片
        .warning-info-item-img {
          width: 119px;
          height: 67px;
          margin-right: 12px;
          :deep(.el-image) {
            width: 100%;
            height: 100%;
          }
        }
        // 无人机信息
        .warning-info-item-uav-info {
          flex: 1;
          display: flex;
          flex-flow: row nowrap;
          justify-content: flex-start;
          align-items: center;
          // 无人机icon
          .uav-icon {
            margin-right: 7px;
            img {
              width: 20px;
              height: 20px;
            }
          }
          // 无人机信息
          .uav-info {
            .uav-name {
              font-size: 14px;
              font-weight: 400;
              letter-spacing: 0px;
              line-height: 14px;
              color: rgba(0, 255, 244, 1);
              margin-bottom: 8px;
            }
            .uav-name2 {
              font-size: 14px;
              font-weight: 400;
              letter-spacing: 0px;
              line-height: 14px;
              color: rgba(175, 215, 230, 1);
            }
          }
        }
        // 日期
        .warning-info-item-date {
          width: 74px;
          .item-date {
            font-size: 14px;
            font-weight: 400;
            letter-spacing: 0px;
            line-height: 14px;
            color: rgba(175, 215, 230, 1);
            margin-bottom: 8px;
          }
          .item-time {
            font-size: 14px;
            font-weight: 400;
            letter-spacing: 0px;
            line-height: 14px;
            color: rgba(175, 215, 230, 1);
          }
        }
      }
    }
  }
}
</style>